package com.gaokuo.es;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author gaokuo
 */
@Data
public class Person {

    final static AtomicInteger AI = new AtomicInteger(0);

    String name = "p" + AI.incrementAndGet();
    int age = new Random().nextInt(5) + 20;
    String sex = (System.currentTimeMillis() & 1) == 1 ? "男" : "女";
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    LocalDateTime birthday = LocalDateTime.now().withYear(LocalDate.now().getYear() - age);

    List<String> friendArr = Arrays.asList("pf" + new Random().nextInt(5),"pf" + new Random().nextInt(5));

    String say = birthday.toString() + System.currentTimeMillis();
}
